package com.rtf.framework.common.distributed.lock;

/**
 * 分布式锁服务<br>
 * 2020-02-09 20:54:22.370 -ERROR -  --- [http-nio-8080-exec-5] StudyRecordService : 198   - 用户: 2316083116462080 课程: 3123175993689088 获取分布式锁失败 <br>
 * 2020-02-09 20:54:22.595 -ERROR -  --- [http-nio-8080-exec-6] StudyRecordService : 198   - 用户: 2316083116462080 课程: 3123175993689088 获取分布式锁失败 <br>
 * 2020-02-09 20:54:23.650 -ERROR -  --- [http-nio-8080-exec-87] StudyRecordService : 198   - 用户: 2316083116462080 课程: 3123175993689088 获取分布式锁失败 <br>
 * @Author : liupeng
 * @Date : 2020-01-23
 * @Modified By
 */
public interface DistributedLocker {

    /**
     * 获取分布式锁
     * @param code
     * @param expiresMills 失效时间，毫秒
     * @return
     */
    DistributedLock acquire(String code , Long expiresMills) ;

    /**
     * 释放分布式锁
     * @param redisLock
     */
    void release(DistributedLock redisLock) ;

    /**
     * 释放分布式锁
     * @param redisLock
     * @param afterExpireTimeMills
     */
    void release(DistributedLock redisLock  , int afterExpireTimeMills ) ;

}
